import React from "react";
import './css/选项卡.css'
import Film from "./maizuoComponent/Film";
import Cinema from "./maizuoComponent/Cinema";
import Center from "./maizuoComponent/Center";
import Tabbar from "./maizuoComponent/Tabbar";
import Navbar from "./maizuoComponent/Navbar";
class Xxk extends React.Component{
    state={
        list:[
            {
                id:1,
                text:"电影"
            },
            {
                id:2,
                text:"影院"
            },
            {
                id:3,
                text:"我的"
            }
        ],
        curr:0
    }
    which(){
        switch(this.state.curr){
            case 0:
                return <Film></Film>
            case 1:
                return <Cinema></Cinema>
            case 2:
                return <Center></Center>
            default:
                return null
        }
    }
    render(){
        return(
            <div>
                <Navbar myevent={()=>{
                    console.log("触发方法")
                    //跳转到center
                    this.setState({
                        curr:2
                    })
                }}></Navbar>
                {/* {
                    this.state.curr===0 && <Film></Film>
                }
                {
                    this.state.curr===1 && <Cinema></Cinema>
                }
                {
                    this.state.curr===2 && <Center></Center>
                } */}
                {
                    this.which()
                }
                <Tabbar event={(index)=>{
                    console.log("接收到子组件传来的下标",index)
                    this.setState({
                        curr:index
                    })
                }} curr={this.state.curr} list={this.state.list}></Tabbar>
            </div>
        )
    }
}
export default Xxk